package greate.project.base1;

import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.AviatorEvaluatorInstance;
import com.googlecode.aviator.Expression;

import java.io.IOException;

/**
 * 简单的执行运算
 *
 * @author v_zhangshun01
 */
public class Simple01 {

    public static void main(String[] args) throws IOException {

//         获取执行器实例
        final AviatorEvaluatorInstance aviatorEvaluatorInstance = AviatorEvaluator.newInstance();

//        编译脚本，并且开启缓存。
        final Expression expression = aviatorEvaluatorInstance.compileScript("base1/simple01.av", true);

//        执行编译厚的脚本，并且返回结构
        final Object execute = expression.execute(expression.newEnv("a", 1, "b", 2, "c", 4));

//        打印结果
        System.out.println(execute);
    }

}
